<template>
  <div>
    <van-tabbar v-model="active">
      <van-tabbar-item icon="home-o" :class="{on: '/msite'===$route.path}" @click="goTo('/msite')">首页</van-tabbar-item>
      <van-tabbar-item icon="search" :class="{on: '/search'===$route.path}" @click="goTo('/search')">真香</van-tabbar-item>
      <van-tabbar-item icon="coupon-o" :class="{on: '/order'===$route.path}" @click="goTo('/order')">订单</van-tabbar-item>
      <van-tabbar-item icon="friends-o" :class="{on: '/person'===$route.path}" @click="goTo('/person')">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data () {
    return {
      active: 0
    }
  },
  methods: {
    goTo (path) {
      // 通过path 切换路由
      this.$router.replace(path)
    }
  }
}
</script>

<style lang="less" scoped>
</style>
